package com.laikan.reader.core.adapter;

import android.annotation.SuppressLint;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.laikan.reader.core.LaikanBaseAdapter;
import com.laikan.reader.R;
import com.laikan.reader.core.bean.Consume;

import java.util.ArrayList;

/**
 * @author wx 消费记录listview的适配器
 */
public class Personal_Recharge_Adapter extends LaikanBaseAdapter<Consume> {

    public Personal_Recharge_Adapter(Context context, ArrayList<Consume> moreList) {
        super(context,  moreList);
    }

    @SuppressLint ({"ResourceAsColor", "InflateParams"})
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        ViewHoder viewHoder = null;
        if (convertView == null) {
            convertView = View.inflate(mContext, R.layout.personal_recharge_item, null);
            viewHoder = new ViewHoder();
            viewHoder.content1 = (TextView)convertView.findViewById(R.id.text1);
            viewHoder.time = (TextView)convertView.findViewById(R.id.text3);
            viewHoder.money = (TextView)convertView.findViewById(R.id.text4);
            viewHoder.rela_recharge = (RelativeLayout)convertView.findViewById(R.id.rela_recharge);
            convertView.setTag(viewHoder);
        }else {
            viewHoder = (ViewHoder)convertView.getTag();
        }
        // if(position%2==0){
        // viewHoder.rela_recharge.setBackgroundColor(R.color.recharge_bg);
        // }
        viewHoder.content1.setText(datas.get(position).getContent());
        viewHoder.time.setText(datas.get(position).getDate());
        viewHoder.money.setText("+" + datas.get(position).getMoney() + "K币");

        return convertView;
    }

    public class ViewHoder {

        public TextView content1;
        public TextView time;
        public TextView money;
        public RelativeLayout rela_recharge;

    }

}
